import React from 'react';
import ReactMarkdown from 'react-markdown';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import rehypeRaw from 'rehype-raw';

/** https://blog.csdn.net/weixin_44589651/article/details/121044772
 * @param {string} content Markdown文本内容
 */
export default React.memo(({ content }) => (
  <ReactMarkdown
    remarkPlugins={[remarkMath]}
    rehypePlugins={[rehypeKatex, rehypeRaw]}
  >
    {content}
  </ReactMarkdown>
));